#pragma once

#define __S				1
#define __O				0

/* range生成0-255之间的整数 */
#define __RANGE_HELP(i, _)		i,

#define __REMOVE_LASTCOMMA(x, ...)	x __VA_OPT__(, DEFER(__REMOVE_LASTCOMMA_)(__VA_ARGS__))
#define __REMOVE_LASTCOMMA_(x, ...)	x __VA_OPT__(, DEFER(__REMOVE_LASTCOMMA)(__VA_ARGS__))

#define REMOVE_LAST_COMMA(...)		EVAL(__REMOVE_LASTCOMMA(__VA_ARGS__))          

#define RANGE8(uint8)			REMOVE_LAST_COMMA(EVAL(REPEAT(uint8, __RANGE_HELP, _)))


/* TODO: plus递归加 */

#define __INC8_REC0(x, ...)		INC8 __ETY (__INC8_REC1 __ETY (__VA_ARGS__))
#define __INC8_REC1(x, ...)		INC8 __ETY (__INC8_REC0 __ETY (__VA_ARGS__))
#define __INC8_REC(...)			EVAL(__INC8_REC0(__VA_ARGS__))

#define PLUS8(x, y)			__INC8_REC(RANGE8(y), x)

